home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-23 | 1.9 KB | 72 lines | [TEXT/KAHL] |
- /**********************************************************************
-
- FnError.cp
-
- ***********************************************************************/
-
- /*
- Provides a very simple error dialog in the center of the screen.
- You have the option of immediately quitting application after user
- clicks OK.
-
- Functions Include:
-
- FnErr_DisplayStrID Display error using string ID
- FnErr_DisplayStr Display error string
- */
-
- /********** Available Error ID's */
- const short kGeneralError = 900;
- const short kBadSystem = 901;
- const short kNoResource = 902;
- const short kAppleEventError = 903;
-
- /********** Constants */
- const short kErrorAlert = 900;
- #define kNilPtr 0L
- #define kNilStr "\p"
- #define kFatalError "\pFatal Error!"
-
- /********** Prototypes */
- void FnErr_DisplayStrID( int stringNum,
- int quitFlag );
- void FnErr_DisplayStr( Str255 s1,
- Str255 s2,
- Str255 s3,
- Str255 s4,
- int quitFlag );
-
- /********** DisplayStrID */
-
- void FnErr_DisplayStrID( int stringNum, int quitFlag )
- {
- StringHandle errorStringH;
-
- if ( ( errorStringH = GetString( stringNum ) ) == kNilPtr )
- ParamText( kFatalError, kNilStr, kNilStr, kNilStr );
- else
- {
- HLock( (Handle)errorStringH );
- ParamText( *errorStringH, kNilStr, kNilStr, kNilStr );
- HUnlock( (Handle)errorStringH );
- }
- StopAlert( kErrorAlert, kNilPtr );
- if( quitFlag )
- ExitToShell();
- }
-
- /********** DisplayStr */
-
- void FnErr_DisplayStr( Str255 s1,
- Str255 s2,
- Str255 s3,
- Str255 s4,
- int quitFlag )
- {
- ParamText( s1, s2, s3, s4 );
- StopAlert( kErrorAlert, kNilPtr );
- if( quitFlag )
- ExitToShell();
- }
-
- // End of File